<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>瑞邦晟达科技（北京）有限公司</title>
<meta name="author" content="盛浩峰" />
<link rel="stylesheet" href="css/public.css"  />
<link rel="stylesheet" href="css/index.css"  />
<link rel="stylesheet" href="css/second_list.css"  />
</head>
<body>
    <?php include 'top.php';?>
    <div id="content">
        <!-- head begin -->
        <div id="container">
            <div id="banner2"><img src="images/<?php echo file_exists(dirname(__FILE__) . '/images/banner_'.$_GET['pid']).'.jpg'?'banner_'.$_GET['pid'].'.jpg':'banner_2.jpg' ?>"  /></div>
        </div>
        <!-- head end -->
        <!-- content begin -->
        <div id="bottom">
            <!-- content left begin -->
            <div id="left_nav">
                <?php 
                    function CheckParam()
                    {
                    	$result=0;
                    	if(isset($_GET['pid']) && isset($_GET['nid']))
                    	{
                    		if (is_numeric($_GET['pid']) && is_numeric($_GET['nid'])) {
                    			$result=1;
                    		}
                    	}
                    	return $result;
                    }

                    if(!CheckParam())
                    {                    	
                    	echo '输入字符串不正确，请不要尝试输入非法字符串！';
                    	exit();
                    }
                    $MySqlHelper = new MySqlHelper();
                    $FirstNavName='';
                    $row=$MySqlHelper->GetRow('select NavName from NavTree where Status = 1 and ID = '.$_GET['pid']);
                    $FirstNavName = $row['NavName'];
                ?>
                <h2><?php echo $FirstNavName;?><span></span></h2>
                <ul>
                    <?php 
	                    $rows = $MySqlHelper->GetRows('select ID,NavName,NavigateUrl,PID from NavTree where Status = 1 and PID = '.$_GET['pid']);
	                    while ($row = $rows->fetch_assoc())
	                    {
                    ?>
                    <li><a <?php echo $row['ID']===$_GET['nid']?'class="Selected"':'';?> href="<?php echo $row['NavigateUrl'];?>pid=<?php echo $row['PID']?>&nid=<?php echo $row['ID']?>"><?php echo $row['NavName']?></a></li>
                    <?php }?>
                </ul>
            </div>
            <!-- content right begin -->
            <div id="right_contain">
                <h3><span><?php echo $FirstNavName;?></span></h3>
                <div class="list_new" id="ListContainer"></div>
                <div id="PagerLine"><!-- <span>首页</span> <span>上一页</span> <span>1</span> <span>2</span> <span>3</span> <span>4</span> <span>下一页</span> <span>末页</span> --></div>
            </div>
            <!-- content right end -->
            <!-- content left end -->
        </div>
        <!-- content end -->
        <!-- copyright begin -->
        <?php include 'copyright.html';?>
        <!-- copyright end -->
    </div>
    <?php 
        $row=$MySqlHelper->GetRow('select count(*) as count from Content where Status = 1 and NavID = '.$_GET['nid']);
    ?>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="js/nav.js"></script>
    <script type="text/javascript" src="js/jquery.pager.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    	PageClick(1);
    });
    function PageClick(pageClickNo) {
    	GetListContent(pageClickNo);
    	$("#PagerLine").pager({ pagenumber: pageClickNo, pagecount: GetPageCount(), buttonClickCallback: PageClick });
    }
    //返回页数
    function GetPageCount() {
        return Math.ceil(<?php echo $row['count'];?> / 15);
    }
    function GetListContent(pageClickNo){
        $.ajax({
            url: 'listcontent.php',
            type: "POST",
            dataType: "html",
            data:'pageNo='+pageClickNo+'&pageSize=15&pid=<?php echo $_GET['pid'];?>&nid=<?php echo $_GET['nid'];?>',
            cache: true,
            success: function (data) {
            	$("#ListContainer").html(data);
            },
            error: function (jqXHR) {
                document.write(jqXHR.responseText);
            }
        })
    }
    </script>
</body>
</html>